/**
 * 
 */


function changeStatus(id,status)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'categories/changeStatus';

	$.ajax({
	 type: "POST",
	  url: $base_url+$url,
	  async: false,
	  data: {id:id, action:status},
	  dataType: "json"
	}).done(function(d){
		location.reload();
	})
}

function changePosition(id,action)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'categories/changePosition';

	$.ajax({
	 type: "POST",
	  url: $base_url+$url,
	  async: false,
	  data: {id:id, action:action},
	  dataType: "json"
	}).done(function(d){
		location.reload();
		//console.log(d);
	})
}

function deleteCatThumb(id)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'categories/deleteCatThumb';

	$.ajax({
	 type: "POST",
	  url: $base_url+$url,
	  async: false,
	  data: {id:id},
	  dataType: "json"
	}).done(function(d){
		location.reload();
		//console.log(d);
	})
}

function changeProductStatus(id,status)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'products/changeProductStatus';

	$.ajax({
	 type: "POST",
	  url: $base_url+$url,
	  async: false,
	  data: {id:id, action:status},
	  dataType: "json"
	}).done(function(d){
		location.reload();
	})
}

function changeProductPosition(id,action)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'products/changeProductPosition';
	
	$.ajax({
	 type: "POST",
	  url: $base_url+$url,
	  async: false,
	  data: {id:id, action:action},
	  dataType: "json"
	}).done(function(d){
		location.reload();
		//console.log(d);
	})
}

function makeCover(photo_id, product_id)
{
	//$base_url='http://localhost:8888/yuhuashop/root/yuhua-admin/';
	$base_url = 'http://www.yuhuashop.com/yuhua-admin/';
	$url = 'products/makeCover';
	
	$.ajax({
		 type: "POST",
		  url: $base_url+$url,
		  async: false,
		  data: {photo_id:photo_id, product_id:product_id},
		  dataType: "json"
		}).done(function(d){
			location.reload();
			//console.log(d);
		})
}
